import java.io.Serializable;

public class Card implements Serializable
{
	private static final long serialVersionUID = -1314682854868265534L;
	private String znak_karty;			//znak karty
	private String wartosc_karty;		//wartosc karty
	private String owner;				//właściciel karty
	
	public Card()
	{
		znak_karty = new String();
		wartosc_karty = new String();
		owner = new String();
	}
	
	public Card(String znak, String wartosc)
	{
		znak_karty = new String(znak);
		wartosc_karty = new String(wartosc);
		owner = new String();
	}
	
	public String pokaz_znak()
	{
		return znak_karty;
	}
	
	public String pokaz_wartosc()
	{
		return wartosc_karty;
	}
	
	public void set_owner(String nazwa)
	{
		owner = nazwa;
	}
	
	public String wlasciciel()
	{
		return owner;
	}
	
	public int rozpoznaj_wartosc()
	{
		for (int i = 2; i < 11; ++i)
			if (wartosc_karty.equals(Integer.toString(i)))
				return (i-1);
		if (wartosc_karty.equals("J"))
			return 10;
		else if (wartosc_karty.equals("Q"))
			return 11;
		else if (wartosc_karty.equals("K"))
			return 12;
		else if (wartosc_karty.equals("A"))
			return 13;
		
		return 0;
	}

	public void ustaw(String znak, String wartosc, String wlasciciel)
	{
		znak_karty = znak;
		wartosc_karty = wartosc;
		owner = wlasciciel;
	}
	
	public void zamien(Card k2)
	{
		Card temp = new Card(this.znak_karty, this.wartosc_karty);
		this.wartosc_karty = k2.wartosc_karty;
		this.znak_karty = k2.znak_karty;
		k2.znak_karty = temp.znak_karty;
		k2.wartosc_karty = temp.wartosc_karty;
	}
	
	public boolean compare(Card karta)
	{
		if (this.wartosc_karty.equals(karta.wartosc_karty))
			return true;
		
		return false;
	}
}